package com.service.impl;

import com.agui.dao.IDaoService;
import com.agui.dao.po.UserInfoPo;
import com.agui.dao.service.UserInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by heyugui on 2017/4/17.
 * Description
 */
@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService{
    @Resource
    private IDaoService daoService;
    @Override
    public int addUserInfo(UserInfoPo userInfoPo) {
        return daoService.insert(userInfoPo);
    }

    @Override
    public int modifyUserInfo(UserInfoPo userInfoPo) {
        return daoService.update(userInfoPo);
    }

    @Override
    public int deleteUserInfo(UserInfoPo userInfoPo) {
        return daoService.delete(userInfoPo);
    }

    @Override
    public UserInfoPo getUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectOne(userInfoPo);
    }

    @Override
    public void deleteUsers(String[] ids) {
        for (String id : ids){
            UserInfoPo userInfoPo = new UserInfoPo();
            userInfoPo.setId(id);
            daoService.delete(userInfoPo);
        }
    }
    @Override
    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo,int pageNo,int pageSize) {
        return daoService.selectList(userInfoPo,pageNo,pageSize);
    }

    @Override
    public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo) {
        return daoService.selectList(userInfoPo);
    }

    @Override
    public int getTotal(UserInfoPo userInfoPo) {
        return daoService.count(userInfoPo);
    }
}
